package main.java.ensao.cryptography.elgamalmodule;

import java.awt.Color;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JButton;
import javax.swing.JPanel;
import javax.swing.JTextField;

public class ELGAMALGeneratingSessionKeyListner implements ActionListener {
	
	public void actionPerformed(ActionEvent e) {

		
	JPanel pan = (JPanel) ((JButton) e.getSource()).getParent();
	pan.setForeground(new Color(255, 255, 10));

    JTextField p = (JTextField) (((JPanel) pan.getComponent(1))).getComponent(1);
	JTextField Kb = (JTextField) (((JPanel) pan.getComponent(4))).getComponent(1);
    JTextField alpha = (JTextField) (((JPanel) pan.getComponent(7))).getComponent(1);
	JTextField k_session = (JTextField) (((JPanel) pan.getComponent(8))).getComponent(1);

	ElGamal gamal=new ElGamal();
	gamal.Generate_Session_Key(alpha.getText(),Kb.getText(),p.getText());	
	
	k_session.setText(gamal.getK().toString());

	
		

	}

}
